<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/3/31 0031
 * Time: 下午 3:05
 */

namespace Admin\Controller;


class OrderController extends BaseController
{
    public function lst(){
        $model = D('Order');
        $data = $model->lst();
        $this->assign(array(
            'data' =>$data['data'],
            'page' =>$data['page'],
        ));
        //设置页面中的信息
        $this->assign(array(
            '_page_title'=>'订单列表',
        ));
        $this->display();
    }

    public function edit(){
        if(IS_POST){
            $model = D('Order');
            if($model->create(I('post.'),2)){
                if($model->save() !== FALSE){
                    $this->success('订单更新成功!',U('lst',array('p'=>I('get.p',1))));
                    exit;
                }
            }
            $this->error($model->getError());
        }
        $orderId = I('get.order_id');
        $orderModel = D('Order');
        $orderData = $orderModel->getDetail($orderId);
        $this->assign('order',$orderData);

        //设置页面中的信息
        $this->assign(array(
            '_page_title' =>'订单更新',
            '_page_btn_name' =>'列表',
            '_page_btn_link' =>U('lst')
        ));
        $this->display();
}
}